// eslint-disable-next-line
import { BasicLayout } from '@/layouts'
// import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

/**
 * 异步路由
 */
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    redirect: '/overview/all',
    meta: { title: 'menu.home' },
    children: [
      {
        path: '/overview',
        name: 'overview',
        component: () => import('@/views/overview/index'),
        redirect: '/overview/all',
        hideChildrenInMenu: true,
        meta: { title: '项目总览', keepAlive: true, icon: 'idcard' },
        children: [
          // 全部项目
          {
            path: '/overview/all',
            name: 'All',
            hidden: true,
            component: () => import('@/views/overview/allItems/index'),
            meta: { title: '全部项目', keepAlive: true }
          },
          // 进行中项目
          {
            path: '/overview/ongoing',
            name: 'Ongoing',
            hidden: true,
            component: () => import('@/views/overview/ongoing/index'),
            meta: { title: '进行中', keepAlive: true }
          },
          // 关闭的项目
          {
            path: '/overview/close',
            name: 'Close',
            hidden: true,
            component: () => import('@/views/overview/close/index'),
            meta: { title: '关闭的项目', keepAlive: true }
          }

        ]
      },
      // 项目详情
      {
        // path: '/overview/detail/responsible',
        path: '/overview/detail',
        name: 'Responsible',
        hidden: true,
        // hideChildrenInMenu: true,
        // redirect: '/overview/detail/responsible',
        component: () => import('@/views/overview/detail/responsible/index'),
        // component: RouteView,
        meta: { title: '项目详情', keepAlive: true, icon: 'bar-chart', permission: ['PROJECT'] }
        // children: [
        //   {
        //     path: '/overview/detail/responsible',
        //     // name: 'ResponsibleDetail',
        //     name: 'Responsible',
        //     hidden: true,
        //     component: () => import('@/views/overview/detail/responsible/index'),
        //     meta: { title: '项目详情', keepAlive: true, permission: ['PROJECT'] }
        //   }
        // ]
      },
      // 财务详情
      {
        path: '/overview/detail/treasure',
        name: 'Treasure',
        hidden: true,
        component: () => import('@/views/overview/detail/treasurer/index'),
        meta: { title: '财务详情', keepAlive: true, permission: ['PROJECT'] }
      },
      {
        path: '/overview/detail/treasure/payment-detail',
        name: 'PaymentDetail',
        hidden: true,
        component: () => import('@/views/cost-apply/applyDetail'),
        meta: { title: '付款明细', keepAlive: true, permission: ['PROJECT'] }
      },
      {
        path: '/overview/detail/treasure/finance-detail',
        name: 'FinanceDetail',
        hidden: true,
        component: () => import('@/views/overview/detail/treasurer/components/finance/FinanceDetail'),
        meta: { title: '资金流水', keepAlive: true, permission: ['PROJECT'] }
      },
      // 费用审核
      {
        path: '/cost-auditing',
        name: 'costAuditing',
        // hidden: true,
        component: () => import('@/views/cost-auditing/costAuditing'),
        meta: { title: '费用管理', keepAlive: true, icon: 'pay-circle', permission: ['FEE_REVIEW'] }
      },
      // 费用申请
      {
        path: '/cost-apply',
        name: 'CostApply',
        hidden: true,
        component: () => import('@/views/cost-apply/index'),
        meta: { title: '费用申请', keepAlive: true, icon: 'money-collect' }
      },
      // 项目内费用审核
      {
        path: '/expense-audit',
        name: 'ExpenseAudit',
        hidden: true,
        component: () => import('@/views/cost-auditing/ExpenseAudit'),
        meta: { title: '费用审核', keepAlive: true, icon: 'pay-circle' }
      },
      // 费用申请->研究者
      {
        path: '/cost-apply/researcher-list',
        name: 'ResearcherList',
        hidden: true,
        component: () => import('@/views/cost-apply/researcher/ResearcherList'),
        meta: { title: '费用申请列表', keepAlive: true }
      },
      {
        path: '/cost-apply/add-researcher',
        name: 'AddResearcher',
        hidden: true,
        component: () => import('@/views/cost-apply/researcher/AddResearcher'),
        meta: { title: '新增费用申请', keepAlive: true }
      },
      // 费用申请->受试者
      {
        path: '/cost-apply/subject-list',
        name: 'SubjectList',
        hidden: true,
        component: () => import('@/views/cost-apply/subject/SubjectList'),
        meta: { title: '费用申请列表', keepAlive: true }
      },
      {
        path: '/cost-apply/add-subject',
        name: 'AddSubject',
        hidden: true,
        component: () => import('@/views/cost-apply/subject/AddSubject'),
        meta: { title: '新增费用申请', keepAlive: true }
      },
      {
        path: '/cost-apply/apply-details',
        name: 'ApplyDetail',
        hidden: true,
        component: () => import('@/views/cost-apply/applyDetail'),
        meta: { title: '费用申请详情', keepAlive: true }
      },
      // 付款详情
      {
        path: '/suditingDetail',
        name: 'suditingDetail',
        hidden: true,
        component: () => import('@/views/overview/detail/costAuditing/suditingDetail'),
        meta: { title: '申请详情', keepAlive: true }
      },
      // 费用申请
      {
        path: '/PayList',
        // hidden: true,
        name: 'PayList',
        component: () => import('@/views/pay/PayList'),
        meta: { title: '费用申请', icon: 'pay-circle', permission: ['FEE_APPLY'] }
      },
      // 付款详情
      {
        path: '/PayDetail',
        name: 'PayDetail',
        hidden: true,
        component: () => import('@/views/pay/PayDetail'),
        meta: { title: '申请详情', keepAlive: true }
      },
      // 组织机构
      {
        path: '/organization',
        name: 'organization',
        meta: { title: '组织机构', keepAlive: true, icon: 'apartment', permission: ['ORGANIZATION'] },
        component: () => import('@/views/organization/organization')
      },
      // 消息
      {
        path: '/message',
        name: 'message',
        hidden: true,
        meta: { title: '消息', keepAlive: true, icon: 'apartment' },
        component: () => import('@/views/message/message')
      },
      // 系统管理
      {
        path: '/system',
        component: () => import('@/views/system/index'),
        name: 'system',
        meta: { title: '系统管理', alive: true, icon: 'team', permission: ['SYSTEM'] }
      },
      // 添加角色
      {
        path: '/addRole',
        name: 'AddRole',
        hidden: true,
        meta: { title: '添加角色', icon: 'user' },
        component: () => import('@/views/system/addRole')
      },
      // 编辑角色
      {
        path: '/editRole',
        name: 'EditRole',
        hidden: true,
        meta: { title: '编辑角色', icon: 'user' },
        component: () => import('@/views/system/editRole')
      },
      // 系统日志
      {
        path: '/system-log',
        name: 'SystemLog',
        component: () => import('@/views/system-log/index'),
        meta: { title: '系统日志', keepAlive: true, icon: 'file-text', permission: ['LOG'] }
      },
      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        redirect: '/exception/403',
        meta: { title: 'menu.exception', icon: 'warning', permission: ['exception'] },
        children: [
          {
            path: '/exception/403',
            name: 'Exception403',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
            meta: { title: 'menu.exception.not-permission', permission: ['exception'] }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
            meta: { title: 'menu.exception.not-find', permission: ['exception'] }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
            meta: { title: 'menu.exception.server-error', permission: ['exception'] }
          }
        ]
      },
      // account
      {
        path: '/settings',
        name: 'settings',
        hidden: true,
        meta: { title: '个人设置', icon: 'user', keepAlive: true },
        component: () => import('@/views/account/settings/Index')
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  },
  // 完善个人信息
  {
    path: '/person',
    name: 'Person',
    hidden: true,
    meta: { title: '完善个人信息', keepAlive: true, icon: 'apartment' },
    component: () => import('@/views/person/Index')
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login'),
    hidden: true
  },
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  },
  {
    path: '/403',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403')
  },
  {
    path: '/attestation',
    name: 'attestation',
    hidden: true,
    component: () => import('@/views/attestation/Index')
  },
  {
    path: '/jump-mp',
    name: 'jumpMp',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/JumpMp')
  },
  // 隐私
  {
    path: '/privacy',
    name: 'Privacy',
    component: () => import(/* webpackChunkName: "fail" */ '@/layouts/components/Privacy')
  },
  // 条款
  {
    path: '/clause',
    name: 'Clause',
    component: () => import(/* webpackChunkName: "fail" */ '@/layouts/components/Clause')
  }
]
